/**
 * Created by plter on 2016/11/10.
 */

(function () {

    var b = document.querySelector("#b");
    var content = document.querySelector("#content");
    var currentElement;

    b.addEventListener("dragenter", function (e) {
        e.preventDefault();
    });
    b.addEventListener("dragover", function (e) {
        e.preventDefault();
    });
    b.addEventListener("drop", function (e) {
        if (currentElement && currentElement.parentNode) {
            currentElement.parentNode.removeChild(currentElement);
            this.appendChild(currentElement);
        }
    });

    content.addEventListener("dragstart", function (e) {
        currentElement = this;
    });


})();